//
//  UIVIew+extention.swift
//  组件化测试
//
//  Created by Red App on 2019/1/11.
//  Copyright © 2019 CEC-CESEC. All rights reserved.
//

import Foundation
import UIKit

extension UIView{
    
    func getFirstViewController() -> UIViewController?{
        
        for view in sequence(first: self.superview, next: {$0?.superview}){
            
            if let responder = view?.next{
                
                if responder.isKind(of: UIViewController.self){
                    
                    return responder as? UIViewController
                }
            }
        }
        return nil
    }
}
